package org.ww.cms.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.ww.cms.bean.CrmBanner;
import org.ww.cms.service.CrmBannerService;
import org.ww.commonutils.R;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author ww
 * @since 2020-10-31
 */
@RestController
@RequestMapping("/cms/bannerfront")
//@CrossOrigin
public class BannerFrontController {
    @Autowired
    private CrmBannerService crmBannerService;

    /**
     * 获取前两条的banner信息
     * @return
     */
    @GetMapping("/getBanner")
    @Cacheable(value = "banner" , key = "'selectIndexList'")
    public R getAllBanner(){
        List<CrmBanner> list=crmBannerService.getAllBanner();
        return R.ok().data("list",list);
    }
}

